// 用户逻辑相关请求
import request from "@/utils/request";

// 登录
export const userLogin = ({ username, password }) => {
  return request.post("login", { username, password });
};

//新增角色
export const rolePost = (roleData) => {
  return request.post("classes/VueRole", roleData);
};

//加载角色列表
export const roleGet = (roleid) => {
  let search = roleid ? `/${roleid}` : "";
  return request.get(`classes/VueRole${search}`);
};

//删除角色
export const roleDel = (objectId) => {
  return request.delete(`classes/VueRole/${objectId}`);
};

//更新角色
export const rolePut = (objectId, roleData) => {
  return request.put(`classes/VueRole/${objectId}`, roleData);
};

// 注册（分配账号）
export const userReg = (userObj) => {
  return request.post("users", userObj);
};

// 查询用户列表
export const userGet = (roleId) => {
  return request.get("users", {
    params: {
      where: {
        roleid: roleId,
      },
    },
  });
};
